package lingou.homework.postbar.controller.proto.resp;

public class ImageResponse {
    private int errno;
    private Data data;
    private String message;

    public static ImageResponse ofSuccess(String url, String alt, String href) {
        ImageResponse imageResponse = new ImageResponse();
        imageResponse.data = new Data(url, alt, href);
        imageResponse.errno = 0;
        return imageResponse;
    }

    public static ImageResponse ofFailure(String message){
        ImageResponse imageResponse = new ImageResponse();
        imageResponse.errno = 1;
        imageResponse.message = message;
        return imageResponse;
    }

    public int getErrno() {
        return errno;
    }

    public void setErrno(int errno) {
        this.errno = errno;
    }

    public Data getData() {
        return data;
    }

    public void setData(Data data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return "ImageResponse{" +
                "errno=" + errno +
                ", data=" + data +
                ", message='" + message + '\'' +
                '}';
    }

}

class Data {
    String url, alt, href;
    Data(String url, String alt, String href) {
        this.url = url;
        this.alt = alt;
        this.href = href;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAlt() {
        return alt;
    }

    public void setAlt(String alt) {
        this.alt = alt;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    @Override
    public String toString() {
        return "Data{" +
                "url='" + url + '\'' +
                ", alt='" + alt + '\'' +
                ", href='" + href + '\'' +
                '}';
    }
}
